// Table.h: interface for the CTable class.
//
//////////////////////////////////////////////////////////////////////

#ifndef __TABLE_H__
#define __TABLE_H__

#include "Block.h"
#include "Hand.h"
#include "Tableau.h"
#include "Foundation.h"
#include "Wastepile.h"
#include "iface.h"

typedef enum {
    DO_MOVELEFT = 0,
    DO_MOVEUP,
    DO_MOVERIGHT,
    DO_MOVEDOWN,
    DO_ACTION,
	DO_RELAYOUT,
    DO_SELPLUS,
    DO_SELMINUS,
    DO_HELP,
    DO_SETUP,
    DO_INIT,
    DO_WIZARD,
    DO_SEL_0,
    DO_SEL_1,
    DO_SEL_2,
    DO_SEL_3,
    DO_SEL_4,
    DO_SEL_5,
    DO_SEL_6,
    DO_SEL_7,
    DO_SEL_8,
    DO_SEL_9 } t_doing;
    
typedef enum {
    DIR_LEFT = 0,
    DIR_UP,
    DIR_RIGHT,
    DIR_DOWN } t_direction;
    
typedef enum {
	L800X600 = 0,
	L600X800,
	L_COUNT	} t_layouts;

	
class SlotPos
{
public:
	int x;
	int y;
	int width;
	int height;
	SlotPos() {  x = 0; y = 0; width = 0; height = 0; } ;
	SlotPos( int _x, int _y, int _width, int _height ) { x = _x; y = _y; width = _width; height = _height; }
};

class CTableGrid;

class CTable : CIface
{
public:
	void Display( bool _full_update = false );
	void Handle( t_doing _doing );
	int Run();
	bool Relayout();
	CTable();
	virtual ~CTable();

private:

	void ShowHelp();
	void CheckWin( bool _add );
	void Wizard();
	void DoAction();
	void MoveCursor( t_direction _direction );
	void Init();
	bool Setup();
	void Save();
	void Load();
	void Deal();

    unsigned char       act_row;


	CTableGrid		*grid;
	bool 			game_over;
	int				scores;
	
	int				layout;

	
protected:
	void ChangeSelection( bool select = true, bool select_all = true );
};

#endif // __TABLE_H__
